package com.jsu.clubmanagementsystem.service.user;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jsu.clubmanagementsystem.common.PageQueryRequest;
import com.jsu.clubmanagementsystem.model.dto.user.*;
import com.jsu.clubmanagementsystem.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jsu.clubmanagementsystem.model.vo.user.UserListsVO;
import jakarta.servlet.http.HttpServletRequest;

/**
* @author 24753
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-05-13 17:29:48
*/
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param registerRequest
     * @param isAdmin
     * @return
     */
    boolean userRegister(UserRegisterRequest registerRequest, boolean isAdmin);

    /**
     * 管理员注册
     *
     * @param registerRequest
     * @return
     */
    boolean adminRegister(AdminRegisterRequest registerRequest);

    /**
     * 用户登录
     *
     * @param loginRequest
     * @param request
     * @return
     */
    User userLogin(UserLoginRequest loginRequest, HttpServletRequest request);

    /**
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 更新登录用户信息之后同步更新session中的信息
     *
     * @param id
     * @param request
     * @return
     */
    void updateLoginUser(long id, HttpServletRequest request);

    /**
     * 获取当前登录用户信息
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 创建用户
     *
     * @param addRequest
     * @return
     */
    Long addUser(UserAddRequest addRequest);

    /**
     * 修改用户信息
     *
     * @param updateRequest
     * @return
     */
    boolean updateUser(UserUpdateRequest updateRequest);


    /**
     * 获取查询封装
     *
     * @param queryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest queryRequest);


    /**
     * 用户是否存在
     *
     * @param userId
     * @return
     */
    boolean isExist(Long userId);

    /**
     * 判断当前登录用户是否为管理员
     *
     * @param request
     * @return
     */
    boolean isAdmin(HttpServletRequest request);

    Page<UserListsVO> getAllUser(PageQueryRequest page);

    boolean removeUser(Long userId);

    User addUsers(UserAddRequest addRequest);

}
